<template>
	<view>
		<view class="tab-list">
			<u-tabs :scrollable="false" lineColor="#287E34" activeStyle="#287E34" :list="tabList" @click="tabChange"></u-tabs>
		</view>
		<orderList :orderRob="2" :isJifen="2" :lists="lists" :orderType="2"></orderList>
	</view>
</template>

<script>
	import orderList from '@/components/order-list.vue'
	export default {
		components: {
			orderList
		},
		data() {
			return {
				tabItem: '全部',
				lists:[],
				tabList: [{
						name: '全部',
					},
					{
						name: '待发货',
					},
					{
						name: '待收货'
					},
					{
						name: '已完成'
					}
				]
			}
		},
		onShow() {
			this.lists = [];
			this.init();
		},
		methods: {
			init() {
				// wait_delivery=待发货 wait_receipt=待收货 finish=已完成
				this.$http('other.getOrderList', {
					status: this.tabItem == '全部' ? '' : this.tabItem == '待发货' ? 'wait_delivery' : this.tabItem == '待收货' ?'wait_receipt':'finish'
				}, '获取中...').then(res => {
					if (res.code == 1) {
						this.lists = res.data.data
					}
				})
			},
			tabChange(item) {
				this.tabItem = item.name
				this.init();
			}
		}
	}
</script>
<style lang="scss" scoped>
	page {
		background-color: #F6F7F9;
	}
	.tab-list{
		width: 750rpx;
		height: 94rpx;
		background: #FFFFFF;
	}
</style>